<?php

namespace Alipay\AlipayFund\Request;

use Alipay\AlipayFund\Info\Parties;
use Alipay\AlipayFund\Response\AlipayFundTransUniTransferResponse;
use Alipay\Common\RequestBase;

class AlipayFundTransUniTransferRequest extends RequestBase
{
    protected $method = 'alipay.fund.trans.uni.transfer';

    protected $response = AlipayFundTransUniTransferResponse::class;

    /**
     * @var Parties
     */
    private $party;

    /**
     * 商家侧唯一订单号
     * @var string
     */
    private $outBizNo;

    /**
     * 转账业务的标题
     * @var string
     */
    private $orderTitle;

    /**
     * 业务备注
     * @var string
     */
    private $remark;

    /**
     * 订单总金额
     * @var string
     */
    private $amount;

    /**
     * 转账业务请求的扩展参数
     * @var string
     */
    private $callBackParams;

    /**
     * 生成请求参数
     * @return array
     * @author xis
     */
    public function generate(): array
    {
        $content = [
            'out_biz_no' => $this->outBizNo,
            'trans_amount' => $this->amount,
            'product_code' => 'TRANS_ACCOUNT_NO_PWD',
            'biz_scene' => 'DIRECT_TRANSFER',
            'order_title' => $this->orderTitle,
            'payee_info' => $this->party->generate(),
            'business_params' => $this->callBackParams,
        ];
        if ($this->remark) {
            $content['remark'] = $this->remark;
        }

        return $content;
    }

    /**
     * @param Parties $party
     * @return AlipayFundTransUniTransferRequest
     */
    public function setParty(Parties $party): self
    {
        $this->party = $party;
        return $this;
    }

    /**
     * @param string $outBizNo
     * @return AlipayFundTransUniTransferRequest
     */
    public function setOutBizNo(string $outBizNo): self
    {
        $this->outBizNo = $outBizNo;
        return $this;
    }

    /**
     * @param string $orderTitle
     * @return AlipayFundTransUniTransferRequest
     */
    public function setOrderTitle(string $orderTitle): self
    {
        $this->orderTitle = $orderTitle;
        return $this;
    }

    /**
     * @param string $remark
     * @return AlipayFundTransUniTransferRequest
     */
    public function setRemark(string $remark): self
    {
        $this->remark = $remark;
        return $this;
    }

    /**
     * @param string $amount
     * @return AlipayFundTransUniTransferRequest
     */
    public function setAmount(string $amount): self
    {
        $this->amount = $amount;
        return $this;
    }

    /**
     * @param string $callBackParams
     * @return AlipayFundTransUniTransferRequest
     */
    public function setCallBackParams(string $callBackParams): self
    {
        $this->callBackParams = $callBackParams;
        return $this;
    }

}